
var WXUI = cc.Class({


    statics: {

        /**
         *显示的标题， 图标（success/loading）, 延迟的时间
         */
        makeText: function (showContent, iconFlag, mDuration) {
            var iconType = iconFlag == 0 ? 'success' : 'loading';
            wx.showToast({
                title: showContent,
                icon: iconType,
                duration: mDuration
            })
        },
        /**
         * 判断用户是不是IPHONEX
         */
        setUserIsIpX: function () {
            if (SystemInfo.getPlatform() != 'weChatGame') {
                return;
            }
            var systemInfo = wx.getSystemInfoSync();;
            var model = systemInfo.model.toString();
            if (model.search("iPhone X") != -1) {
                SystemInfo.setRunInIphoneX(true);
            }
        },

        /**
         * 打开客服对话
         */
        openCustomerServiceConversation: function () {
            if (SystemInfo.getPlatform() != 'weChatGame') {
                return;
            }

            wx.openCustomerServiceConversation({
                success: function () {
                    //console.log('正常打开客服会话!');
                },
                fail: function () {
                    //console.log('打开客服会话失败!');
                },
                complete: function () { }
            });
        },

    }
});

module.exports = WXUI;